import  java.util.*;
public class Test {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            String arr = sc.nextLine();
            String ret = sc.nextLine();
            HashSet<Character> set = new HashSet<>();
            for (int i = 0; i < ret.length(); i++) {
                set.add(ret.charAt(i));
            }
            //遍历arr字符串
            char[] srt = new char[arr.length()];
            int count = 0;
            for (int j = 0; j < arr.length(); j++) {
                if (!set.contains(arr.charAt(j))) {
                    System.out.print(arr.charAt(j));
                }
            }
        }
    }
    public static void main2(String[] args) {
        Scanner sc =new Scanner(System.in);
        int n=sc.nextInt();
        int [] arr=new int [n*3];
        for(int i=0;i< arr.length;i++){
            arr[i]=sc.nextInt();
        }
        //给数组排序
        Arrays.sort(arr);
        int sum=0;
        int i=0;
        for(i=arr.length-2;i>n;i=i-2){
            sum=sum+arr[i];
        }
        System.out.println(sum);
    }
    public static void main1(String[] args) {
        Solution solution=new Solution();
        solution.GetUglyNumber_Solution(7);
        System.out.println("aaaa");
    }
}
